package sample.test;

import static org.junit.Assert.assertEquals;

import org.databene.benerator.anno.Database;
import org.databene.benerator.anno.Source;
import org.databene.feed4junit.Feeder;
import org.junit.Test;
import org.junit.runner.RunWith;

import sample.code.UserAccess;

/*
 * Feed4JUnit - Get Data from Database, 
 only the specified method can use the database data
 */
@RunWith(Feeder.class)
public class F4JfromDB_Method {

	@Test 
	@Database(
			id = "test", 
			url = "jdbc:mysql://localhost/test", 
			driver = "com.mysql.jdbc.Driver", 
			user = "root", 
			password = "123456")
	@Source(id = "test", selector = "select * from TEST")
	public void testAccessCheck(String userName, String pw, String expected) {
		Boolean bSucess = UserAccess.accessCheck(userName.trim(), pw.trim());
		assertEquals(expected.trim(), bSucess.toString());

	}
}
